package main

import (
	"github.com/smallnest/rpcx/client"
	"smallnest-rpcx/advanced/services"
	"context"
	"log"
)

func main() {
	d := client.NewConsulDiscovery("/rpcx","tcp@127.0.0.1:8972", []string{	//consul的地址
		"127.0.0.1:8500",
	},nil)

	xclient := client.NewXClient("Arith", client.Failtry, client.RandomSelect, d, client.DefaultOption)
	defer xclient.Close()

	var args *services.FuncArgs
	var reply *services.FuncReply
	err := xclient.Call(context.Background(), "services.SendPong", args, reply)
	if err != nil {
		log.Fatalf("failed to call: %v", err)
	}

	log.Println(reply)
}
